package p.ithorns.integration.transform.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import p.ithorns.integration.transform.entity.Account;
import p.ithorns.integration.transform.entity.Order;
import p.ithorns.integration.transform.entity.User;
import p.ithorns.integration.transform.service.OrderService;
import p.ithorns.integration.transform.service.UserService;

import java.util.Collection;

/**
 * OrderController
 *
 * @author ithorns
 * @version 1.0
 * @date 2019/11/11 16:35
 */
@Slf4j
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    @GetMapping("/list")
    public Collection<User> list() {
        // @RequestParam("coll") Set<String> coll log.info("参数：{}", coll);
        Collection<User> list = userService.listUsers();
        log.info("转换结果：{}", list);
        return list;
    }

    @GetMapping("/get")
    public User get() {
        User user = userService.getUser();
        log.info("转换结果：{}", user);
        return user;
    }

    @GetMapping("/account")
    public Account getAccount() {
        Account account = userService.getAccount();
        log.info("转换结果：{}", account);
        return account;
    }

}
